
             
/**
 * Copyright (c) 2012-2013 JLLT Corp. 2012-2013,All Rights Reserved.
 * This software is published under the 金麟龙腾商贸有限公司.
 * License version 1.0, a copy of which has been included with this
 * distribution in the LICENSE.txt file.
 *
 * @File name:  UpdateTStorageMemberAction.java   修改【寄存客户信息:T_STORAGE_MEMBER】
 * @Create on:  2012-08-08 11:02:308
 * @Author   :  陈伟
 *
 * @ChangeList
 * ---------------------------------------------------
 * Date         Editor              ChangeReasons
 *
 */
           
        

package com.boho.ecp.deposit.custom.action;

            
import java.sql.Connection;
import java.util.Date;

import cn.boho.framework.actions.ActionImp;
import cn.boho.framework.context.ActionContext;
import cn.boho.framework.exception.UserOperationException;
import cn.boho.framework.po.POUtils;
import cn.boho.framework.service.MessageService;

import com.boho.ecp.constant.Staff;
import com.boho.ecp.po.TStorageMemberPO;
import com.boho.ecp.util.MatchUtils;
            
        
public class UpdateTStorageMemberAction extends ActionImp {
	private TStorageMemberPO conditionTStorageMemberPO = new TStorageMemberPO();
	private TStorageMemberPO valueTStorageMemberPO = new TStorageMemberPO();
	private Date date = new Date();
	private Connection con = null;
	private Integer storageMemberNo;
	private String memberNo;
	private String memberName;
	private String mobile;
	private String updateBy;
	@Override
	protected void doException(ActionContext atx, Exception ex) {
		if (!(ex instanceof UserOperationException)) {
			atx.setErrorContext("BOHO_COMMON_1002", MessageService.getMessage("BOHO_COMMON_1002"),"【寄存客户信息】" ,ex);
		}
	}
	@Override
	protected int performExecute(ActionContext atx) throws Exception {
		if(MatchUtils.isEmpty(storageMemberNo)){
			valueTStorageMemberPO.setMemberNo(memberNo);
			valueTStorageMemberPO.setMemberName(memberName);
			valueTStorageMemberPO.setMobile(mobile);
			valueTStorageMemberPO.setCreateBy(updateBy);
			valueTStorageMemberPO.setCreateDate(date);
			POUtils.insert(con, valueTStorageMemberPO, false);
		}
		else{
			conditionTStorageMemberPO.setStorageMemeberNo(storageMemberNo);
			valueTStorageMemberPO.setMemberNo(memberNo);
			valueTStorageMemberPO.setMemberName(memberName);
			valueTStorageMemberPO.setMobile(mobile);
			valueTStorageMemberPO.setUpdateBy(updateBy);
			valueTStorageMemberPO.setUpdateDate(date);
			POUtils.update(con, conditionTStorageMemberPO, valueTStorageMemberPO,false);
		}
		
		return 1;
	}
	@Override
	protected int verifyParameters(ActionContext atx) throws Exception {
		con = atx.getConection();
		updateBy = atx.getStringValue(Staff.STAFF_SESSION_NO);
		storageMemberNo = atx.getIntegerValue("STORAGE_MEMEBER_NO",-1);
		memberNo = atx.getStringValue("MEMBER_NO");
		memberName = atx.getStringValue("MEMBER_NAME");
		mobile = atx.getStringValue("MOBILE");
		return 1;
	}
}
